<template>
    <div id="OrdersTitle">
        <v-details :inputConfig="inputConfig" :detailData="inputData" :rules="rules" @changeData="changeData"
                   ref="input"></v-details>
    </div>
</template>

<script>
    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        props: {
            inputData: {
                type: Object,
            }
        },
        mixins: [baseMixin],
        name: "OrdersTitle",
        data() {
            return {}
        },
        computed: {
            inputConfig() {
                return [
                  [
                    {
                      type: "",
                      props: "lblordlimit",
                      label: this.$t('transmit.lblordlimit')
                    },
                    {
                      type: "select",
                      label: this.$t('config.sku'),
                      props: "importtypeSku",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10301")
                    },
                    {
                      type: "select",
                      label: this.$t('config.carrierCode'),
                      props: "importtypeCarrier",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10304")
                    },
                    {
                      type: "",
                      label: this.$t('transmit.lblordlimit1'),
                      props: "lblordlimit1"
                    },
                    {
                      type: "select",
                      label: this.$t('transmit.importtypeB2C'),
                      props: "importtypeB2C",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10307")
                    },
                    {
                      type: "select",
                      label: this.$t('in.asn'),
                      props: "importtypeASN",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10309")
                    },
                    {
                      type: "select",
                      label: this.$t('transmit.importtypeReceiptPreflight'),
                      props: "importtypeReceiptPreflight",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10317")
                    },
                    {
                      type: "select",
                      label: this.$t('transmit.importtypeDeliveryOrder'),
                      props: "importtypeDeliveryOrder",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10321")
                    }
                  ],
                  [
                    {
                      type: "",
                      props: "lblordlimit2",
                      label: "&nbsp;"
                    },
                    {
                      type: "select",
                      label: this.$t('bill.customer'),
                      props: "importtypeCustomer",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10302")
                    },
                    {
                      type: "select",
                      label: this.$t('config.shipper'),
                      props: "importtypeStorerkey",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10305")
                    },
                    {
                      type: "",
                      props: "lblordlimit3",
                      label: "&nbsp;"
                    },
                    {
                      type: "select",
                      label: this.$t('transmit.importtypeB2B'),
                      props: "importtypeB2B",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10311")
                    },
                    {
                      type: "select",
                      label: this.$t('in.pokey1'),
                      props: "importtypePo",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10310")
                    },
                    {
                      type: "select",
                      label: this.$t('transmit.importtypeASNSerialDetail'),
                      props: "importtypeASNSerialDetail",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10318")
                    }
                  ],
                  [
                    {
                      type: "",
                      props: "lblordlimit4",
                      abel: "&nbsp;",
                    },
                    {
                      type: "select",
                      label: this.$t('transmit.importtypeCarton'),
                      props: "importtypeCarton",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10303")
                    },
                    {
                      type: "select",
                      label: this.$t('ex.putawayzone'),
                      props: "importtypePutawayzone",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10306")
                    },
                    {
                      type: "",
                      props: "lblordlimit5",
                      label: "&nbsp;"
                    },
                    {
                      type: "select",
                      label: this.$t('transmit.importtypeLineStop'),
                      props: "importtypeLineStop",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10314")
                    },
                    {
                      type: "select",
                      label: this.$t('transmit.importtypeASNDetail'),
                      props: "importtypeASNDetail",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10315")
                    },
                    {
                      type: "select",
                      label: this.$t('ex.intertransition'),
                      props: "importtypeTransfer",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10319")
                    },
                    {
                      type: "select",
                      label: this.$t('work.openingInventoryImport'),
                      props: "importtypeOpeningInventory",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10323")
                    },

                  ],
                  [
                    {
                      type: "",
                      props: "lblordlimit4",
                      abel: "&nbsp;",
                    },
                    {
                      type: "select",
                      label: this.$t('transmit.importTypeLoc'),
                      props: "importTypeLoc",
                      options: this.getOptions("sysExcelImportRule/queryTemplateByType/10325")
                    }
                  ]
                ]

            },
            rules() {
                //企业级独有
                let flag1 = false;
                //仓库级独有
                let flag2 = false;
                //企业和仓库都有
                let flag3 = true;
                if (!this.$store.state.wms.includes('wmwhse')) {
                    flag1 = true;
                }else{
                    flag2 = true;
                }
                return {
                    importtypeSku: [
                        {required: flag1, trigger: 'blur'},
                    ],
                    importtypeCustomer: [
                        {required: flag3, trigger: 'blur'},
                    ],
                    importtypeCarton: [
                        {required: flag2, trigger: 'blur'},
                    ],
                    importtypeCarrier: [
                        {required: flag3, trigger: 'blur'},
                    ],
                    importtypeStorerkey: [
                        {required: flag3, trigger: 'blur'},
                    ],
                    importtypePutawayzone: [
                        {required: flag2, trigger: 'blur'},
                    ],
                    importtypeB2C: [
                        {required: flag2, trigger: 'blur'},
                    ],
                    importtypeB2B: [
                        {required: flag2, trigger: 'blur'},
                    ],
                    importtypeASN: [
                        {required: flag2, trigger: 'blur'},
                    ],
                    importtypePo: [
                        {required: flag2, trigger: 'blur'},
                    ],
                    importtypeLineStop: [
                        {required: flag2, trigger: 'blur'},
                    ],
                    importtypeASNDetail: [
                        {required: flag2, trigger: 'blur'},
                    ],
                  importtypeReceiptPreflight: [
                        {required: flag2, trigger: 'blur'},
                    ],
                  importtypeASNSerialDetail: [
                        {required: flag2, trigger: 'blur'},
                    ],
                  importtypeTransfer: [
                        {required: flag2, trigger: 'blur'},
                    ],
                  importtypeDeliveryOrder: [
                    {required: flag2, trigger: 'blur'},
                  ],
                  importTypeLoc: [
                    {required: flag2, trigger: 'blur'},
                  ]
                }
            }
        },
        methods: {
            changeData(data) {
                if (this.$parent.$parent.permissionStatus) {
                    this.$parent.$parent.saveStatus = false;
                }
            }
        },
        mounted() {
        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
